#include "Dice.h"



Dice::Dice()
{	
	x = 2, y = 2;
	dice.loadFromFile("dice.png");
	imgdice.setTexture(dice);
	imgdice.setTextureRect(IntRect(x,y,100,99));
	imgdice.setScale(Vector2f(0.6, 0.6));
	imgdice.setPosition(Vector2f(1100, 350));

}
void Dice::move(int val)
{
	int gg = val;
	Vector2i src = Vector2i(x,y);
	src.x += 100;
	cnt++;
	if(cnt==6)
	{
		cnt = 0;
		src = Vector2i(x,y);
		flag = false;
	}
	else if (cnt == gg)
	{
		flag = false;
	}
	else
	{
		imgdice.setTextureRect(IntRect(x,y,100,99));
		imgdice.setScale(Vector2f(0.6, 0.6));
		imgdice.setPosition(Vector2f(1100, 350));
	}

}
Dice::~Dice()
{
}

int Dice::random()
{
	int x = (rand() % 6);
	std::cout << x << std::endl;
	if (x == 0)return 1;
	else
		return x;
}